package com.lzx.spring3;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class AppConfig {

	public static String userName;
	
	@Autowired(required = true)
	public void setUserName(@Value("${jdbc.username}") String userName) {
		System.err.println(userName);
		AppConfig.userName = userName;
	}

	
	
	@Autowired(required = true)
	public void setUserName1(@Value("#{config[username]}") String userName) {
		System.err.println(userName);
		AppConfig.userName = userName;
	}
	
	@Autowired(required = true)
	public void setUserName2(@Value("#{config.username}") String userName) {
		System.err.println(userName);
		AppConfig.userName = userName;
	}
	
	@Autowired(required = true)
	public void setUserName3(@Value("#{config['jdbc.username']}") String userName) {
		System.err.println(userName);
		AppConfig.userName = userName;
	}

}
